<?php

/*
*
* BEGIN content_handler.php
*
*
* Dazzler Custom Content Loader
* @Description: Switches between different content based on the URI. Defaults to content/sitecontent.php which in this particular site loads the Dazzler Template found in templates/main.php
* @Authors: Salman, Wits University
* @Copyright: © Wits University 2011 - All Rights Reserved
* @License: BSD License (http://www.linfo.org/bsdlicense.html)
*
*
* BEGIN CHANGELOG
* Developers working on thee files are REQUIRED to maintain this CHANGELOG.
* Please ensure you follow the Changelog Guidelines: http://code.google.com/p/dazzler/wiki/DazzlerDevelopGuideline?ts=1315476570&updated=DazzlerDevelopGuideline
* !==================================================================================================================================================================
*
* VERSION 1.0.0
*	+ File Created, Salman, 8 September 2011
*
* ==================================================================================================================================================================!
* END CHANGELOG
*/


/*******************************************************************************************************************************************************************
*
* BEGIN Direct Call Check
*
/******************************************************************************************************************************************************************/
global $doNotCallThisScriptDirectly;
if ($doNotCallThisScriptDirectly != 1)
{
	/* Read the ini language file */
	$ini_lang_array = array();
	$clientlang = explode(",", strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']));
	$lang_ini_array = (file_exists("lang/" . trim($clientlang[0]) . ".ini")) ? parse_ini_file("lang/" . trim($clientlang[0]) . ".ini", true) : parse_ini_file("lang/en.ini", true);
	die ($lang_ini_array['ERRORS']['doNotCallThisScriptDirectly']);
}
/*******************************************************************************************************************************************************************
*
* END Direct Call Check
*
/******************************************************************************************************************************************************************/



/*******************************************************************************************************************************************************************
* BEGIN Parse the REQUEST URI to extract the calls, pages IDs, etc
/******************************************************************************************************************************************************************/

$uri_array = explode("/", $_SERVER['REQUEST_URI']);

/* Based on the URI, load different content heandlers */
switch ($uri_array[2])
{
 case "matchstatspoller":
                              include "longpoller/matchstatspoller.php";
	break;
    case "longpoller":
                         include "longpoller/pollinghandler.php";
	break;

        case "ajaxhandler":
                include "ajaxhandler/ajaxhandler.php";
	break;
        case "commentator":
                include "commentator/commentator.php";
        break;
            case "livematch":
            include "livematch.php";
        break;
        case "about":
            include "about.php";
        break;
            case "terms":
            include "terms.php";
        break;
    case "listofCommentators":
        include "listofcommentators.php";
        break;
                case "privacy":
            include "privacy.php";
        break;
                    case "contact":
            include "contact.php";
        break;
           case "signout":
            include "signout.php";
        break;
               case "teams":
            include "teams.php";
        break;
                   case "players":
            include "players.php";
        break;
                       case "games":
            include "games.php";
        break;
	default:
		include "main.php";
	break;
}
/*******************************************************************************************************************************************************************
* END Parse the REQUEST URI to extract the calls, pages IDs, etc
/******************************************************************************************************************************************************************/

/*
*
* END content_handler.php
*
*/
?>